package com.polaris.live.utils.route

import com.polaris.live.common.util.ToastGravity
import com.polaris.live.constant.LiveConst
import com.polaris.live.manager.LiveStateManager
import com.polaris.live.floating.FloatingWindowManager
import com.polaris.live.translation.R.string
import com.polaris.live.ui.backpack.BackpackActivity
import com.polaris.live.ui.backpack.ShoppingMallActivity
import com.polaris.live.ui.block.BlockActivity
import com.polaris.live.ui.block.WeekCallActivity
import com.polaris.live.ui.follow.FollowActivity
import com.polaris.live.ui.game.WebGameActivity
import com.polaris.live.ui.honor.HonorActivity
import com.polaris.live.ui.live.activity.CallVideoActivity
import com.polaris.live.ui.live.activity.LiveSpectatorActivity
import com.polaris.live.ui.live.activity.LiveVideoActivity
import com.polaris.live.ui.live.activity.NoticeMatchActivity
import com.polaris.live.ui.live.activity.StartMatchActivity
import com.polaris.live.ui.live.activity.end.call.GainCallEndActivity
import com.polaris.live.ui.live.activity.end.call.PayCallEndActivity
import com.polaris.live.ui.live.activity.end.live.LiveEndActivity
import com.polaris.live.ui.live.activity.end.live.SpectatorEndActivity
import com.polaris.live.ui.live.activity.end.voice.VoiceEndActivity
import com.polaris.live.ui.login.AccountAppealActivity
import com.polaris.live.ui.login.GmailLoginActivity
import com.polaris.live.ui.login.LoginActivity
import com.polaris.live.ui.login.PhoneNumberActivity
import com.polaris.live.ui.login.verify.SetPasswordActivity
import com.polaris.live.ui.main.activity.CeShiActivity
import com.polaris.live.ui.main.activity.RankRuleActivity
import com.polaris.live.ui.main.activity.UserGameRankActivity
import com.polaris.live.ui.main.activity.UserRankActivity
import com.polaris.live.ui.me.AgencyInviteActivity
import com.polaris.live.ui.me.ContributionListActivity
import com.polaris.live.ui.me.InviteFriendActivity
import com.polaris.live.ui.me.MyAnchorLevelActivity
import com.polaris.live.ui.me.MyChatPriceActivity
import com.polaris.live.ui.me.MyInviteRewardActivity
import com.polaris.live.ui.me.RichCharmActivity
import com.polaris.live.ui.me.beans.MyBeansActivity
import com.polaris.live.ui.me.beans.MyWithdrawActivity
import com.polaris.live.ui.me.beans.MyWithdrawDetailActivity
import com.polaris.live.ui.me.beans.WithdrawSuccessActivity
import com.polaris.live.ui.me.diamond.DiamondActivity
import com.polaris.live.ui.message.MessageActivity
import com.polaris.live.ui.message.MessageGreetActivity
import com.polaris.live.ui.message.MessageStrangerActivity
import com.polaris.live.ui.message.MessageUploadGreetActivity
import com.polaris.live.ui.party.activity.PartyAnchorActivity
import com.polaris.live.ui.party.activity.PartySpectatorActivity
import com.polaris.live.ui.party.activity.RoomSettingActivity
import com.polaris.live.ui.party.activity.game.PartyGameAnchorActivity
import com.polaris.live.ui.party.activity.game.PartyGameSpectatorActivity
import com.polaris.live.ui.party.activity.video.PartyVideoAnchorActivity
import com.polaris.live.ui.recharge.RechargeActivity
import com.polaris.live.ui.set.AboutActivity
import com.polaris.live.ui.set.AccountBindActivity
import com.polaris.live.ui.set.BindGmailActivity
import com.polaris.live.ui.set.BindPhoneActivity
import com.polaris.live.ui.set.FeedbackSuggestionActivity
import com.polaris.live.ui.set.SettingActivity
import com.polaris.live.ui.set.cover.SetCoverActivity
import com.polaris.live.ui.set.cover.SetLiveImageActivity
import com.polaris.live.ui.set.cover.SetPartyCoverActivity
import com.polaris.live.ui.user.ActCenterActivity
import com.polaris.live.ui.user.InfoUserActivity
import com.polaris.live.ui.user.ReleaseDynamicActivity
import com.polaris.live.ui.user.SearchUserActivity
import com.polaris.live.ui.user.task.TaskCenterActivity
import com.polaris.live.ui.user_space.GiftDetailActivity
import com.polaris.live.ui.user_space.GiftReceivedActivity
import com.polaris.live.ui.user_space.LikeActivity
import com.polaris.live.ui.user_space.SealAccountActivity
import com.polaris.live.ui.user_space.SignOutActivity
import com.polaris.live.ui.user_space.UserSpaceActivity
import com.polaris.live.ui.vip.activity.VipCenterActivity
import com.polaris.live.ui.vip.activity.VipDetailActivity
import com.polaris.live.ui.web.WebActivity
import com.polaris.live.ui.welcome.DiscontinuedActivity
import com.polaris.live.utils.getIntOrString

/**
 * 路由实现
 *
 * @author Created by lucas on 2023/10/16 17:01
 */
object RouterImpl {

    internal val routers = mutableListOf<RouterAddress>(
        //测试页面
        RoutePath.CESHI_ACTIVITY nav CeShiActivity::class,
        //登录页面
        RoutePath.LOGIN_ACTIVITY nav LoginActivity::class,
        //设置页面
        RoutePath.SET_ACTIVITY nav SettingActivity::class,
        //充值页面
        RoutePath.RECHARGE nav RechargeActivity::class,
        //输入手机号页
        RoutePath.PHONE_NUMBER_ACTIVITY nav PhoneNumberActivity::class,
        //输入手机号页
        RoutePath.GMAIL_ACTIVITY nav GmailLoginActivity::class,
        //修改密码页
        RoutePath.SET_PASSWORD_ACTIVITY nav SetPasswordActivity::class,
        //拨打方 通话结束页
        RoutePath.LIVE_PAY_CALL_END_ACTIVITY nav PayCallEndActivity::class,
        //接收方 通话结束页
        RoutePath.LIVE_GAIN_CALL_END_ACTIVITY nav GainCallEndActivity::class,
        //消息详情页
        RoutePath.MESSAGE_ACTIVITY nav MessageActivity::class,
        //陌生人打招呼页面
        RoutePath.MESSAGE_STRANGER_ACTIVITY nav MessageStrangerActivity::class,
        //消息打招呼页
        RoutePath.MESSAGE_GREET_ACTIVITY nav MessageGreetActivity::class,
        //上传打招呼页
        RoutePath.MESSAGE_UPLOAD_GREET_ACTIVITY nav MessageUploadGreetActivity::class,
        //封面页
        RoutePath.SET_LIVE_IMAGE_ACTIVITY nav SetLiveImageActivity::class,
        //他人或个人空间
        RoutePath.USER_SPACE_ACTIVITY nav UserSpaceActivity::class,
        //封号空间页
        RoutePath.SEAL_ACCOUNT_ACTIVITY nav SealAccountActivity::class,
        //注销空间页
        RoutePath.SIGN_OUT_ACTIVITY nav SignOutActivity::class,
        //编辑资料
        RoutePath.INFO_USER_ACTIVITY nav InfoUserActivity::class,
        //用户榜单
        RoutePath.USER_RANK_ACTIVITY nav UserRankActivity::class,
        //绑定手机号
        RoutePath.BIND_PHONE_ACTIVITY nav BindPhoneActivity::class,
        //绑定邮箱
        RoutePath.BIND_GMAIL_ACTIVITY nav BindGmailActivity::class,
        //壕魅等级
        RoutePath.RICH_CHARM_ACTIVITY nav RichCharmActivity::class,
        //正在匹配页
        RoutePath.LIVE_MATCH_ACTIVIYT nav StartMatchActivity::class,
        //停服公告
        RoutePath.DISCOUNTIUNED_ACTIVITY nav DiscontinuedActivity::class,
        //反馈与建议
        RoutePath.FEEDBACK_AND_SUGGESTION nav FeedbackSuggestionActivity::class,
        //MyBeans页面
        RoutePath.MYBEANS_ACTIVITY nav MyBeansActivity::class,
        //diamond页面
        RoutePath.DIAMOND_ACTIVITY nav DiamondActivity::class,
        //提现页面
        RoutePath.MYWITHDRAW_ACTIVITY nav MyWithdrawActivity::class,
        //提现详情页面
        RoutePath.MYWITHDRAW_DETAIL_ACTIVITY nav MyWithdrawDetailActivity::class,
        //提现成功页面
        RoutePath.WITHDRAW_SUCCESS_ACTIVITY nav WithdrawSuccessActivity::class,
        //黑名单
        RoutePath.SET_BLOCK_ACTIVITY nav BlockActivity::class,
        //关注页面
        RoutePath.USER_FOLLOW_ACTIVITY nav FollowActivity::class,
        //公会邀请页面
        RoutePath.USER_AGENCY_INVITE_ACTIVITY nav AgencyInviteActivity::class,
        //账号申诉页面
        RoutePath.ACCOUNT_APPEAL_ACTIVITY nav AccountAppealActivity::class,
        //账号绑定
        RoutePath.SET_ACCOUNT_BIND_ACTIVITY nav AccountBindActivity::class,
        //我的封面照片页面
        RoutePath.SET_COVER_ACTIVITY nav SetCoverActivity::class,
        //礼物列表
        RoutePath.GIFT_LIST_ACTIVITY nav GiftReceivedActivity::class,
        //礼物详情
        RoutePath.GIFT_DETAIL_ACTIVITY nav GiftDetailActivity::class,
        //直播结束观众端
        RoutePath.LIVE_SPECTATOR_END_ACTIVITY nav SpectatorEndActivity::class,
        //喜欢我的页面
        RoutePath.USER_SPACE_LIKE_ACTIVITY nav LikeActivity::class,
        //主播关播结束页面
        RoutePath.LIVE_END_ANCHOR_ACTIVITY nav LiveEndActivity::class,
        //我的聊天价格
        RoutePath.MY_CHAT_PRICE_ACTIVITY nav MyChatPriceActivity::class,
        //我的主播等级
        RoutePath.MY_ANCHOR_LEVEL_ACTIVITY nav MyAnchorLevelActivity::class,
        //关于
        RoutePath.SET_ABOUT_ACTIVITY nav AboutActivity::class,
        //直播页面
        RoutePath.LIVE_VIDEO_ACTIVITY nav LiveVideoActivity::class,
        //通话页面
        RoutePath.CALL_VIDEO_ACTIVITY nav CallVideoActivity::class,
        //新人通话邀约页面
        RoutePath.NOTICE_MATCH_ACTIVITY nav NoticeMatchActivity::class,
        //web游戏界面
        RoutePath.GAME_WEB_GAME_ACTIVITY nav WebGameActivity::class,
        //背包页
        RoutePath.BACKPACK_ACTIVITY nav BackpackActivity::class,
        //创建语音派对页
        RoutePath.SET_PARTY_COVER_ACTIVITY nav SetPartyCoverActivity::class,
        //派对聊天房关闭
        RoutePath.VOICE_END_ACTIVITY nav VoiceEndActivity::class,
        //语聊房主播端
        RoutePath.PARTY_ANCHOR_ACTIVITY nav PartyAnchorActivity::class,
        //休闲游戏房主
        RoutePath.PARTY_GAME_ANCHOR_ACTIVITY nav PartyGameAnchorActivity::class,
        //休闲游戏榜单
        RoutePath.USER_GAME_RANK_ACTIVITY nav UserGameRankActivity::class,
        //邀请好友页
        RoutePath.INVITE_FRIEND_ACTIVITY nav InviteFriendActivity::class,
        //我的奖励页
        RoutePath.MY_INVITE_REWARD_ACTIVITY nav MyInviteRewardActivity::class,
        //勋章前
        RoutePath.HONOR_ACTIVITY nav HonorActivity::class,
        //周星通话管理
        RoutePath.WEEK_CALL_Activity nav WeekCallActivity::class,
        //贡献榜
        RoutePath.CONTRIBUTION_LIST_ACTIVITY nav ContributionListActivity::class,
        //视频房房主
        RoutePath.PARTY_VIDEO_ANCHOR_ACTIVITY nav PartyVideoAnchorActivity::class,
        //活动中心
        RoutePath.ACTIVITY_CENTER_ACTIVITY nav ActCenterActivity::class,
        //商城
        RoutePath.SHOPPING_ACTIVITY nav ShoppingMallActivity::class,
        //发布动态
        RoutePath.RELEASE_DYNAMIC_ACTIVITY nav ReleaseDynamicActivity::class,
        //公会用户搜索页
        RoutePath.SEARCH_USER_ACTIVITY nav SearchUserActivity::class,
        //榜单规则页
        RoutePath.RANK_RULE_ACTIVITY nav RankRuleActivity::class,
        //派对设置
        RoutePath.ROOM_SETTING_ACTIVITY nav RoomSettingActivity::class,
        //网页
        RoutePath.WEB_ACTIVITY nav WebActivity::class,
        //任务中心
        RoutePath.TASK_CENTER_ACTIVITY nav TaskCenterActivity::class,
        //vip中心
        RoutePath.VIP_CENTER_ACTIVITY nav VipCenterActivity::class,
        //vip明细
        RoutePath.VIP_DETAIL_ACTIVITY nav VipDetailActivity::class
    )

    init {
        //直播观众端
        routers.add(
            RouterAddressExecImpl(
                RoutePath.LIVE_SPECTATOR_ACTIVITY,
                LiveSpectatorActivity::class
            ) {
                //如果已经直播或者打电话不允许进去观众直播间
                if (!LiveStateManager.isNone() && !FloatingWindowManager.isMinimize()) {
                    ToastGravity.showGravity(string.must_quit_live)
                    false
                } else {
                    FloatingWindowManager.onDestroyed(LiveConst.Type.ONLY_LIVE, null)
                    true
                }
            }
        )
        //游戏房观众
        routers.add(
            RouterAddressExecImpl(
                RoutePath.PARTY_GAME_SPECTATOR_ACTIVITY,
                PartyGameSpectatorActivity::class
            ) {
                val mRoomId = it.getStringExtra(LiveConst.Params.ROOMID)
                FloatingWindowManager.onDestroyed(LiveConst.Type.PARTY_GAME_LIVE, mRoomId)
                true
            }
        )
        //语聊房观众
        routers.add(
            RouterAddressExecImpl(
                RoutePath.PARTY_SPECTATOR_ACTIVITY,
                PartySpectatorActivity::class
            ) {
                val mLiveType = it.getIntOrString(LiveConst.Params.LIVETYPE, LiveConst.Type.PARTY_LIVE)
                val mRoomId = it.getStringExtra(LiveConst.Params.ROOMID)
                FloatingWindowManager.onDestroyed(mLiveType, mRoomId)
                true
            }
        )

    }

}